const commonConfig = require('./webpack.common')
const {merge} = require('webpack-merge')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const {DefinePlugin} = require('webpack')
const CopyWebpackPlugin = require("copy-webpack-plugin")

module.exports = merge(commonConfig, {
    mode: 'production',
    devtool: 'nosources-source-map',
    plugins: [
        new CopyWebpackPlugin({ // 复制静态文件
            patterns: [
                {from: path.join(__dirname, 'src/assets'), to: 'assets'}
            ]
        }),
        new HtmlWebpackPlugin({
            filename: 'index.html',
            title: 'Webpack-Vue-Demo',
            template: './public/index.html',
            hash: true,
            favicon: path.resolve('./public/favicon.ico')
        }),
        new DefinePlugin({
            BASE_URL: '"./"'
        })
    ]
})
